
package com.rt.schedulenew.utils.util;
import java.sql.SQLException;
import java.sql.DriverManager;
import java.sql.Connection;
public class DBConn
{
    private static String url;
    private static String username;
    private static String password;
    private static String driver;
    private static Connection conn;
    
    public static Connection conn() {
        System.out.println(DBConn.url);
        Connection conn = null;
        try {
            Class.forName(DBConn.driver);
            try {
                conn = DriverManager.getConnection(DBConn.url, DBConn.username, DBConn.password);
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }
        catch (ClassNotFoundException e2) {
            e2.printStackTrace();
        }
        return conn;
    }
    
    public static void close() {
        if (DBConn.conn != null) {
            try {
                DBConn.conn.close();
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }
    
    static {
        DBConn.url = "jdbc:oracle:thin:@10.21.15.194:1521/sypacs";
        DBConn.username = "spacs";
        DBConn.password = "spacs";
        DBConn.driver = "oracle.jdbc.OracleDriver";
        DBConn.conn = null;
    }
}
